<template>
	<view class="field-tab">
		<u-table border-color="#101010" align="left">
			<u-tr v-for="(item,idx) in field_data" :key="idx">
				<u-td>{{item.name}}</u-td>
				<u-td>
					<u-image :src="item.value" width="100px" mode="widthFix" v-if="item.type == 'file'"
						@click="showPreview(item.value)"></u-image>
					<block v-else>{{item.value}}</block>
				</u-td>
			</u-tr>
		</u-table>
	</view>
</template>

<script>
	export default {
		name: 'u-attr',
		props: {
			// 属性数据
			field_data: {
				type: Array,
				default () {
					return [];
				}
			},
		},
		watch: {},
		computed: {},
		methods: {
			showPreview(url) {
				// #ifdef MP-WEIXIN
				uni.previewImage({
					urls: [url]
				});
				// #endif
			}
		}
	}
</script>

<style lang="scss" scoped>
	.field-tab {
		padding: 10rpx;
	}
</style>